package edu.westga.cs3202.sokoban;


import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.junit.Before;

/**
 * Tests common events from the game.
 * 
 * @author Lewis Williams
 * @version 2011.2.17
 */
public class GameBoardTest extends TestCase {
	
	private GameBoard board= new GameBoard();
	private char[][] boardArray = new char[11][20];

	public GameBoardTest(String name) {
		super(name);
	}
	
	protected void setUp() throws Exception {
		super.setUp();
		board = new GameBoard();
		boardArray = board.getBoard();
		
	}
	
	public void testBoardIsNotEmpty() {		
		assertTrue(boardArray[0][0] == ' ');
	}
	
	public void testTwoBallContact(){
		board.moveUp();
		for(int i = 0; i < 20; i++){
			board.moveLeft();
		}
		assertTrue(board.getCharacter(7, 4) == 'p');
	}
	
	public void testBoarderWalllContact(){
		board.moveUp();
		for(int i = 0; i < 20; i++){
			board.moveRight();
		}
		assertTrue(board.getCharacter(7, 17) == 'p');
	}
	
	public void testGoalRedraw(){
		board.moveUp();
		for(int i = 0; i < 20; i++){
			board.moveRight();
		}
		board.moveLeft();
		assertTrue(board.getCharacter(7, 17) == 'g');
	}
	
	public static Test suite(){
		TestSuite suite = new TestSuite();
	      suite.addTest(new GameBoardTest("testBoardIsNotEmpty"));
	      suite.addTest(new GameBoardTest("testTwoBallContact"));
	      suite.addTest(new GameBoardTest("testBoarderWalllContact"));
	      suite.addTest(new GameBoardTest("testGoalRedraw"));
		return suite;
	}

}
